<?php 
## include required files
/*******************************/
require_once '../../includefiles.php';
include_once("../../model/users.php");
include_once("../../model/trade.php");
include_once("../../model/leads.php");
include_once("../../model/state.php");
require_once '../../model/city.php';
include_once("../../model/budget.php");
include_once '../../model/paypal.php';
include_once '../../model/nab.php';
include_once("../../model/usermembership.php");
include_once("../../model/usermembershipdetail.php");
require_once '../../model/membershipplan.php';
require_once '../../model/admindetails.php';
include_once '../../model/email.php';
require_once '../../includes/classes/paypalfunction.php'; // Pay Pal pro Function file 
require_once '../../redirect.php';

checkUserLogin();


if($_SESSION['user_type'] == '3')
{
	@header("location:".SITE_URL."/");
	exit;
}

$userObj = new Model_Users();
$tradeObj = new Model_TRADE();
$leadObj = new Model_Leads();
$objState = new Model_State();
$objCity = new Model_City();
$budgetObj = new Model_Budget();
$paypalObj = new Model_Paypal();
$objNAB = new Model_NAB();
$memberObj	= new Model_Membership();
$memberDetailObj	= new Model_MembershipDetail();
$objPlan = new Model_PLAN();
$adminObj = new Model_AdminDetails();
$emailObj = new Model_Email();


$userId = $_SESSION['getbids_id'];


$p_paypal = $paypalObj->getDetailsFromPaypal();
$p_nab = $objNAB->getDetailsFromNAB();

if($_GET['id1']!='')
{
	$postjobid = base64_decode($_GET['id1']);	
	$jobdetArray = $userObj->getJobDetailsById($postjobid);				
	
	//code for lead price
	$getleadprice =	$leadObj->getLeadPriceByAreaJobTypeBudget($jobdetArray['area'],$jobdetArray['jobtype_id'],$jobdetArray['approx_budget']);
	if($getleadprice['price']=='')
		$getleadprice['price'] = 10;
	$smarty->assign('getleadprice',$getleadprice);
}


if($_POST['plan_id']!='')
{
	$getplan_details = $objPlan->getPlanDetailsById($_POST['plan_id']);
	$smarty->assign('getplan_details', $getplan_details);
}

$stateArray	 	= $objState->getAllStateWithActiveStatus();
$smarty->assign('stateArray', $stateArray);

/*$cityArr = $objCity->getAllCityWithActiveStatus();
$smarty->assign("cityArray", $cityArr);
*/
$yr_arr = array();
for($i=date('Y');$i<=date('Y')+15;$i++)
{
	$yr_arr[] = $i;
}
$smarty->assign('yr_arr',$yr_arr);


if($_SESSION['msg'] != ''){
	$smarty->assign("msg", $_SESSION['msg']);	
	unset($_SESSION['msg']);
}
if($_SESSION['sucmsg'] != ''){
	$smarty->assign("sucmsg", $_SESSION['sucmsg']);	
	unset($_SESSION['sucmsg']);
}
if($_SESSION['error'] != ''){
	$smarty->assign("errorMsg", $_SESSION['error']);	
	unset($_SESSION['error']);
}
$userDetArray = $userObj->getUserDetailsByUserId($userId);
$smarty->assign('nab',$p_nab[0]);
$smarty->assign('paypal',$p_paypal[0]);
$smarty->assign('userDetArray',$userDetArray);
$active ="leads";
$smarty->assign("active", $active);	



$smarty->display(TEMPLATEDIR.'/modules/leads/payamount.tpl');
unset($smarty);
?>
